﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MediaMonitor.Common;
using System.Data;
using Adex;

namespace MediaMonitor.Users
{
    public partial class All_newsAlertSearch : System.Web.UI.Page
    {
        string mediaTypeName = "";
        string sDate = "";
        string eDate = "";
        string AdvertiserMake = "";
        string AdvertiserName = "";
        string NewsTitle = "";
        string Calification = "";
        string TitleNews = "";
        string Summary = "";
        string Text = "";
        string mediaCode = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["sd"].ToString() != "")
            {
                if (Request.Cookies["Code"].Value != "media")
                {
                    imgHead.ImageUrl = "../images/" + Request.Cookies["Code"].Value + "-head.jpg";
                }
                else
                {
                    imgHead.ImageUrl = "../images/media-head.jpg";
                }


                 sDate = Utility.GetRequestedVal("sd", "01_01_2000").Replace("_", "/");
                 eDate = Utility.GetRequestedVal("ed", "01_01_2000").Replace("_", "/");
                 mediaTypeName = Utility.GetRequestedVal("NewsType", "");
                 AdvertiserMake = Utility.GetRequestedVal("AdvertiserMake", "");
                 AdvertiserName = Utility.GetRequestedVal("Advertiser", "");
                 NewsTitle = Utility.GetRequestedVal("title", "");
                 Calification = Utility.GetRequestedVal("Calification", "");
                 TitleNews = Utility.GetRequestedVal("TitleNews", "");
                 Summary = Utility.GetRequestedVal("Summary", "");
                 Text = Utility.GetRequestedVal("Text", "");
                 mediaCode = Utility.GetRequestedVal("mediaCode", "");
                 DataTable dt = SPs.GetReportNewsAlertAfterFilter(sDate, eDate, mediaTypeName, AdvertiserName, NewsTitle, Calification, TitleNews, Summary, Text, mediaCode, AdvertiserMake).GetDataSet().Tables[2];
                 RadListView1.DataSource = dt;
                 RadListView1.DataBind();
            }
        }
        public bool ifTrue(object val)
        {
            return (val == null) ? false : val.ToString().Equals("TV");

        }
        public bool ifPreshTrue(object val)
        {
            return (val == null) ? false : val.ToString().Equals("Press");

        }
        public bool ifRadioTrue(object val)
        {
            return (val == null) ? false : val.ToString().Equals("Radio");

        }
        public bool ifInternetTrue(object val)
        {
            return (val == null) ? false : val.ToString().Equals("Internet");

        }
    }
}